<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-18 15:23:46
 * @LastEditors: 
 * @LastEditTime: 2024-02-18 15:55:41
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 实现一个类型 IsUnion, 判断输入的类型是不是联合类型，如果是返回 true，否则返回 false

type case1 = IsUnion<string>; // false
type case2 = IsUnion<string | number>; // true
type case3 = IsUnion<[string | number]>; // false

type IsUnion<T, K = T> = 
[T] extends [never] ? false : T extends any ? [K] extends [T] ? false : true : false;
</script>

<style scoped></style>